package com.lingxu.api.ztb.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lingxu.api.ztb.mapper.ProjectInfoMapper;
import com.lingxu.api.ztb.model.ProjectInfo;
import com.lingxu.api.ztb.service.IProjectInfoService;
import com.lingxu.api.ztb.model.vo.ProjectInfoVO;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baomidou.mybatisplus.core.metadata.IPage;


import lombok.extern.slf4j.Slf4j;


import javax.annotation.Resource;
import java.util.*;

/**
 * 项目信息表 服务实现类
 *
 * @author admin
 * @since 2025-08-13
 */
@Slf4j
@Service
public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, ProjectInfo>  implements IProjectInfoService {

    @Resource
    private ProjectInfoMapper projectInfoMapper;

    @Transactional(readOnly = true)
    @Override
    public IPage<ProjectInfoVO> queryPageList(ProjectInfoVO query) {
        Page<ProjectInfoVO> page = new Page<ProjectInfoVO>(query.getPageNo(), query.getPageSize());
        return projectInfoMapper.pageList(page,query);
    }


    @Transactional(readOnly = true)
    @Override
    public List<ProjectInfoVO> list(ProjectInfoVO query) {
        return projectInfoMapper.selectProjectInfoList(query);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void delete(Set<String> ids) {
        if (CollectionUtils.isNotEmpty(ids)) {
            projectInfoMapper.deleteBatchIds(ids);
        }
    }

    @Override
    public List<Map<String, Object>> getGsgxProjectProgressList() {
        return projectInfoMapper.getGsgxProjectProgressList();
    }

    @Override
    public ProjectInfo getProjectDetail(String projectName) {
        return projectInfoMapper.getProjectDetail(projectName);
    }

}
